package com.lsyonlygoddes;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.lsyonlygoddes.vo.UserVo;

/**
 * @author lsyonlygoddes
 * @time 2023/08/29 20:33
 */
public class JsonUtilTest {
    public static void main(String[] args) {
        UserVo vo = new UserVo();
        vo.setUserId(1L);
        vo.setUsername("张三");
        String json = JSONUtil.toJsonStr(vo);
//        System.out.println(json);

        JSONObject jsonObject = JSONUtil.parseObj(json);
        UserVo vo2 = jsonObject.toBean(UserVo.class);

        System.out.println(vo);
        System.out.println(vo2);
        System.out.println(vo == vo2);
    }
}
